﻿using StripeOne.ShortenUrl.Model;
namespace StripeOne.ShortenUrl.API.Common
{
    public class ShortenApiResult<T>
    {
        public StatusCode StatusCode { get; set; }
        public string StatusMessage { get; set; }
        public int Language { get; set; }
        public Paging Paging { get; set; }
        public T Content { get; set; }
        
        public ShortenApiResult()
        {

        }

        public ShortenApiResult(T content, int language, StatusCode code = StatusCode.OK, string message = null)
        {
            StatusMessage = message;
            StatusCode = code;
            Language = language;
            Content = content;
        }

        public ShortenApiResult(ApiErrorException error, int language)
        {
            StatusMessage = error.Message;
            StatusCode = error.StatusCode;
            Language = language;
        }

        public ShortenApiResult<T> SetPaging(int limit, int offset, int count)
        {
            Paging = new Paging
            {
                Limit = limit,
                Offset = offset,
                Count = count
            };

            return this;
        }
    }
}
